#! /bin/bash

curDir=`pwd`

if [ "$1" == "-run" ]; then
   if [ ! -f lajoieBlackwell.jar ]; then
      cd src
      make
      cp lajoieBlackwell.jar ..
      cd $curDir
   fi

   java -jar lajoieBlackwell.jar $2
   exit
fi

if [ "$1" == "" ]; then
   echo "Please provide a user name"
   exit
fi

if [ "$2" == "" ]; then
   echo "Please provide version number (e.g. v2)"
   exit
fi

user=$1
verNum=$2

cd src
make
cp lajoieBlackwell.jar lajoieBlackwell_$verNum.jar
scp lajoieBlackwell_$verNum.jar $user@cs4700dns.ccs.neu.edu:~/Project3
rm lajoieBlackwell_$verNum.jar

if [ "$3" == "-ssh" ]; then
   ssh $user@cs4700dns.ccs.neu.edu
fi
